package com.duobaoyu.dby.supply.biz.strategy.prewarning;

import com.duobaoyu.dby.channel.adapter.enums.biz.config.PreWarningConfigTypeEnum;
import com.duobaoyu.dby.supply.biz.service.order.OrderRepairService;
import com.duobaoyu.dby.supply.biz.strategy.AbstractPreWarningCountStrategy;
import com.duobaoyu.dby.supply.common.biz.dto.config.PreWarningConditionDTO;
import com.duobaoyu.dby.supply.common.biz.dto.order.OrderRepairPageDTO;
import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 
 * @author chenms
 * @date 2023/10/18 6:00 PM
 */
@Component
@RequiredArgsConstructor
public class WaitRepairOrderPreWarningCountStrategy extends AbstractPreWarningCountStrategy {

    private final OrderRepairService orderRepairService;

    @Override
    protected long count(PreWarningConditionDTO preWarningCondition) {
        OrderRepairPageDTO orderRepairPage = new OrderRepairPageDTO();
        orderRepairPage.setPreWarningCondition(preWarningCondition);
        return orderRepairService.count(orderRepairPage);
    }

    @Override
    protected Set<Integer> supportPreWarningTypes() {
        return Sets.newHashSet(PreWarningConfigTypeEnum.WAIT_REPAIR_ORDER.getValue());
    }
}
